package com.dyve.counting;

import java.io.File;

import android.graphics.Bitmap;
import android.util.Log;

public class CountingManager {

	static {
		System.loadLibrary("Engine_Android");
	}

	public static int count(Bitmap paramBitmap1, Bitmap paramBitmap2, int paramInt, String config) {
		Log.i("DEBUG", "Count started with config: " + config);
		int[] arrayOfInt1 = null;
		if (paramBitmap2 != null)
			arrayOfInt1 = new int[1048576];
		int i = paramBitmap1.getWidth();
		int j = paramBitmap1.getHeight();
		int[] arrayOfInt2 = new int[i * j];
		paramBitmap1.getPixels(arrayOfInt2, 0, i, 0, 0, i, j);
		if (paramBitmap2 != null)
			paramBitmap2.getPixels(arrayOfInt1, 0, 1024, 0, 0, 1024, 1024);
		paramInt = doCount(arrayOfInt2, j, i, arrayOfInt1, new File(config).getAbsolutePath(), "", "", paramInt);
		Log.i("DEBUG", "Count finished");
		return paramInt;
	}

	public static String encrypt(String paramString) {
		return encryptString(paramString);
	}

	public static String decrypt(String paramString) {
		return decryptString(paramString);
	}

	public static native String decryptString(String paramString);

	private static native int doCount(int[] paramArrayOfInt1, int paramInt1, int paramInt2, int[] paramArrayOfInt2, String paramString1, String paramString2, String paramString3, int paramInt3);

	public static native String encryptString(String paramString);

	public static native String getLastError();

	public static native int getLastErrorType();

	public static native int getResults(int[] paramArrayOfInt1, int[] paramArrayOfInt2, int[] paramArrayOfInt3, int[] paramArrayOfInt4, int[] paramArrayOfInt5);
}